package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.shopping.converter.TestProductDetailConverter;
import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.persistence.ItemMapper;
import com.cskaoyan.shopping.dto.TestProductDetailDto;
import com.cskaoyan.shopping.service.ITestProductService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @auther cskaoyan
 * @date 2022/5/18:11:42
 */
public class ITestProductServiceImpl implements ITestProductService {

    @Autowired
    ItemMapper itemMapper;

    @Autowired
    TestProductDetailConverter testProductDetailConverter;

    @Override
    public TestProductDetailDto getProductDetail(Long productId) {
        // 查询商品数据
        Item item = itemMapper.selectByPrimaryKey(productId);

        TestProductDetailDto result = testProductDetailConverter.testProductDoToProductDto(item);

        return result;
    }
}
